/********************************************************************
	created:	2009:12:13   11:27:06
	filename: 	custommainsplitwnd.cpp
	author:		zouyf
	describe:	
*********************************************************************/
#include "stdafx.h"
#include "custommainsplitwnd.h"

void FCustomMainSplitWnd::Init(IApplication *pApp)
{
	m_pApp = pApp;
}

int FCustomMainSplitWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	m_SplitWnd.Init(m_pApp);
	m_SplitWnd.Create(m_hWnd, RECT(), L"", WS_CHILDWINDOW | WS_VISIBLE, WS_EX_WINDOWEDGE);
	m_SplitWnd.SetSplitterPos(80);

	SetSplitterPane(0, m_SplitWnd.m_hWnd);
	
	m_LyricWnd.Init(m_pApp);
	m_LyricWnd.Create(m_hWnd, RECT(), L"", WS_CHILDWINDOW | WS_VISIBLE);
	SetSplitterPane(1, m_LyricWnd.m_hWnd);
	SetMsgHandled(FALSE);
	return FALSE;
}

void FCustomMainSplitWnd::OnShowWindow(BOOL bShow, UINT nStatus)
{
	if (!bShow)
		return;

	m_SplitWnd.MoveWindow(0, 0, 200, 100);
	m_SplitWnd.SetSplitterPos(80);
}

LRESULT FCustomMainSplitWnd::DispatchMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT ressult = FALSE;
	switch(uMsg)
	{
	case WM_USER_SETSONGLISTIDX:
		m_SplitWnd.SendMessage(WM_USER_SETSONGLISTIDX, wParam, lParam);
		break;
	case WM_USER_LYCPLAY:
		m_LyricWnd.SendMessage(WM_USER_LYCPLAY, wParam, lParam);
		break;
	case WM_USER_LYCUPDATE:
		m_LyricWnd.SendMessage(WM_USER_LYCUPDATE, wParam, lParam);
		break;
	case WM_USER_LYRESETPOS:
		m_LyricWnd.SendMessage(WM_USER_LYRESETPOS, wParam, lParam);
		break;
	default:
		break;
	}

	return ressult;
}
